#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <string>
#include <QCloseEvent>
#include <QSettings>

using namespace std;

struct DynamicMenu
{
public:
    string Text;
    string File;
    string Args;
};

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
    QSettings* mSetting;
    std::function<void(const char*)> M_ShowStatusMsg;

    void loadMenu();
    void loadStatusBar();
    void loadControl();
    //Qt标准通用对话框
    void runQInputDialog();
    void runQProgressDialog();
    void runQMessageBox();
    void runQErrorMessage();
    void runQColorDialog();
    void runQFontDialog();
    void runQPageSetupDialog();
    void runQFilieDialog();
    void runQPrintDialog();
    void runQWizard();
    void storeValue(const string& key,const string& value);
    void storeValue(const string& key,int value);
    void storeValue(const string& key,double value);
    bool loadValue(const string& key,string& value);
    bool loadValue(const string& key,int& value);
    bool loadValue(const string& key,double& value);
    void newMultiDoc();
    static int M_count;
    int mCurrent=0;
protected:
    void closeEvent(QCloseEvent *event) override;

};
#endif // MAINWINDOW_H
